package logic_settings_user

import (
	v1 "Sailor/app/Sailor-console-server/api/api_task/v1"
	"Sailor/app/Sailor-console-server/internal/consts"
	"Sailor/app/Sailor-console-server/utility/utility_task"
	"context"
	"github.com/gogf/gf/v2/errors/gerror"
	"github.com/gogf/gf/v2/frame/g"
)

func (s *sTask) LogicTaskEnable(ctx context.Context, req *v1.TaskEnableReq) (res *v1.TaskEnableRes, err error) {

	_, err = utility_task.ChangeStatus(req.Uuid, consts.Enabled)
	if err != nil {
		g.Log().Error(ctx, err)
		return nil, gerror.New("修改任务状态失败")
	}

	return &v1.TaskEnableRes{}, nil
}
